Introduction
SC is a script language designed to extend the functionality of a compiled
application. The aim of the project was to create a
flexible script language that can be quickly integrated and used without much
glue code. SC was designed mainly for games,
so it should be efficient and not contain unnecessary features.
The language
is strictly typized, so it is faster, easier to debug and less error prone.
Its syntax resembles C or Java. It is very flexible, you can use your own types, classes, function pointers, operators etc.
from scripts.
SC isn't a standalone language, so it has not implemented data definition functionality,
It uses only data types defined in C/C++ code and exported with the provided API.
SC API allows to use SC scripts in C++ applications.
It is strongly based on macros and templates, so exporting own types is easy and no error prone.
SC API also allow to use some features of SC in C++ code (e.g managed memory) or call functions written
in SC from C++ code.
What is necessary to start
To use SC you need at least basic C++ knowledge. SC may be integrated only with C++ applications, the current
version supports only Microsoft Visual C++ compiler (2005 or above , you can download a free version from Microsoft site).
SC language features
- high level
- strongly typed
- runs on a virtual machine, compiled to bytecode (not interpreted)
- predictible memory management based on variable scope (no garbage collector)
- memory usage
- stack - local fast variables
- managed - dynamicly allocated, lifetime until is referenced
- user - used by variables defined in C++ code and exported to scripts, their memory is not managed by SC environment
- loops (for, while), conditions
- data used in scripts
- data types defined in the host aplication, some built in types
- classes, virtual methods, operators, attributes exported from the host aplication
- arrays
- variables
- local - defined in the script
- automatic - defined on the stack and destroyed at the end of the scope
- shared - defined in the script visible to the end of the script and in other scripts
- static - visible only in the scope of the variable, but initalized only once
- external - defined in the host application and exported to the script at compile time
- functions (stdcall or thiscall calling convention) of C++ syntax
- function pointers
suspending script execution, microthreading support
runtime type information (rtti)
compiling (or loading) code at runtime
SC API features
- Based on interfaces and macros
- Most validation done at compile time
- using SC managed memory in C++ code
- using SC functions in C++ code
- defining data
- Simple types
- Classes
- Namespaces
- Variables
- Functions
- Function pointers
- Aliases